﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace _00365.Biz
{
    public class Features
    {
        public static List<Data.Feature> GetAll()
        {
            return (DBInstance.Models.Features.OrderBy(i => i.Description).ToList());
        }

        public static List<Data.Feature> GetAllButFrom(Data.UserGroup Group)
        {
            List<Data.Feature> currentPerms = Permissions.GetPermissionsFor(Group);
            return  DBInstance.Models.Features.ToList()
                    .Except(currentPerms)
                    .OrderBy(i => i.Description)
                    .ToList();
        }

        public static Data.Feature Get(Guid Id)
        {
            return DBInstance.Models.Features.Where(i => i.Id.Equals(Id)).FirstOrDefault();
        }
    }
}